﻿using SuperX.Common;
using SuperX.Common.APIManager;
using SuperX.Helper;
using SuperX.Helper.ServiceResponse;
using System.Collections.Generic;

namespace SuperX.WebSocketService
{
    [PythonScript(label = "WebSocketController", apply = "WebSocketController", type = "keyword", detail = "")]
    public class WebSocketController : DynamicApiController
    {
        private readonly WebSocketHost _server;

        public WebSocketController(WebSocketHost server)
        {
            Name = nameof(WebSocketController);
            _server = server;
        }

        [WebApi("存储Tag的键值信息", "", "")]
        public ApiResponse<bool> SaveTagsKey(Dictionary<string, bool> tagsKey)
        {
            _server.Config.TagsKey = tagsKey;
            var res = _server.Save();
            return new ApiResponse<bool>() { Data = res };
        }
    }
}